#!/usr/bin/env sh

cd "$(dirname "$0")"
. "./.common.sh"
cd ../..

PATH="$(pwd)/sandbox/composer/bin:$PATH"

if ! chkcmd 'peridot'; then
        echo ' error: "peridot" command not found.'
        echo ' Execute "./support/tools/init" first.'
        exit 1
fi

phpdbg=

if (test $# -ge 1) && (test $1 = 'debug') && chkcmd 'phpdbg'; then
        phpdbg="phpdbg -e"
fi

$phpdbg "$(which peridot)" -c "./support/peridot.php" -g "*.php" "./specs/"
